
********************************************************************************
**************** Replication File for Akbar, Li, Shertzer & Walsh **************
********************************************************************************
* Note: This file produces the complete set of tables and figures from NBER WP 25805.
* Note: Each block of code can be run separately
* Note: The following 3 data files must be in the working Directory:
* 1. blockbusting_master.dta
* 2. IPUMS_Full_Sample_1940_Black_Only.dta
* 3. Pittsburgh_sales_matched.dta
* Note: Also, See "Counter Factual Spreadsheet.xls" for computation of counterfactuals.


********************************************************************************
**************** Figure 1 *******************************************************
********************************************************************************
use blockbusting_master.dta, clear

graph drop _all

kdensity pct_black_hh_on_block1930 if blk1930 == 1, ylabel(0(2)10) ///
xtitle(Percent Black Households on Block) title(Black Households in 1930) ///
subtitle(Distribution of 1930 City-Block Racial Composition) ///
lcolor(black) bgcolor(white) graphregion(color(white)) plotregion(color(white))
graph rename d_1930

kdensity pct_black_hh_on_block1940 if blk1940 == 1, ylabel(0(2)10) ///
xtitle(Percent Black Households on Block) title(Black Households in 1940) ///
subtitle(Distribution of 1940 City-Block Racial Composition) ///
lcolor(black) bgcolor(white) graphregion(color(white)) plotregion(color(white))
graph rename d_1940

kdensity pct_black_hh_on_block1930 if blk1940 == 1,  ///
xtitle(Percent Black Households on Block 1930) title(Black Households in 1940) ///
subtitle(Distribution of 1930 City-Block Racial Composition) ///
lcolor(black) bgcolor(white) graphregion(color(white)) plotregion(color(white))
graph rename d_1940_1930
********************************************************************************
********************************************************************************



********************************************************************************
**************** Figure 2 *******************************************************
********************************************************************************
use blockbusting_master.dta, clear

* Panel A

gen blackobs = (b_b ==1 | w_b ==1) /** I need this variable and it wasn't created **/


keep if pct_black_hh_on_block1930 ==0 & sf1930 == 1 & own1930 == 1 & rent1940==1 & black40 > 0



semipar lnprice40  lnprice30 own1930 sf1930 agg_occ1930 sh_foreignborn1930 sh_laborer1930 mean_ips_age1930 ///
    med_ips_valueh1930 med_ips_rent1930 med_ips_occscore1930, nonpar(black40) ///
    generate(npar_pred) partial (partial) nograph

/*** generate binned data on the "residuals" so that we can plot them ***/
/*** Here we are going to make bins that are 5 pct wide ***/

 gen pct_bin = round(black40*20)/20
 bysort pct_bin: egen residual = mean(partial) /* note: partial are the residuals */
 
 /* Identify one unique observation to use with each bin */
gen tag = 0
replace tag = 1 if pct_bin[_n] ~= pct_bin[_n-1]

/* Plot the figure: Note, the choice of gaussian kernal and polynomial of */
/* degree (1) exactly mimics what is done in the semi-par command.  Put another */
/* way, here we are producing the exact same picture that the semi-par command */
/* produces, only we can now format it and and the binned data as per our desire */
graph drop _all

twoway (lpolyci partial black40, gaussian degree(1) ciplot(rline) lcolor(black)) (scatter residual pct_bin if tag == 1, mcolor(black)), ///
ytitle(Ln(Rent 1940)) xtitle(Percent Black on Block in 1940) title(Ln(Rent 1940) vs. ///
Pct. Black on the Block in 1940) subtitle(Robinson Double Residual w/ Full Controls) ///
legend(order( 3 "Binned Residuals" 1 "90% CI" ///
2 "f(% black on block in 1940)")) ///
bgcolor(white) graphregion(color(white)) plotregion(color(white))

graph rename Rent_combined

* Panel B

/*** Now Generate the graph separately for black and white ***/
twoway (lpolyci partial black40 if blackobs == 1, gaussian degree(1) ///
level(90) ciplot(rline) lcolor(black)) (lpolyci partial black40 if blackobs==0, ///
gaussian degree(1) level(90) ciplot(rline) lpattern(dash) lcolor(black)), ///
ytitle(Ln(Rent 1940)) xtitle(Pct. Black on the Block in 1940) ///
title(Ln. (Rent 1940) vs.  Pct Black on Block in 1940) ///
subtitle(Robinson Double Residual w/ Full Controls) ///
legend(order( 2 "f{subscript:black}(% black on block in 1940)" 1 "90% CI" ///
3 "f{subscript:white}(% black on block in 1940)")) ///
bgcolor(white) graphregion(color(white)) plotregion(color(white))

graph rename Rent_black_v_white
********************************************************************************
********************************************************************************


********************************************************************************
**************** Figure 3 *******************************************************
********************************************************************************
use blockbusting_master.dta, clear

* Panel A

gen blackobs = (b_b ==1 | w_b ==1) /** I need this variable and it wasn't created **/

/*** Drop unused observations ***/

/*** note: 3 different levels of refinement ***/

keep if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & rent1940==0 & black40 > 0
*keep if pct_black_hh_on_block1930 <=.01 & sf1930 == 1 & rent1940==0 & black40 > 0
*keep if pct_black_hh_on_block1930 <=.01 & rent1940==0 & black40 > 0


semipar lnprice40  lnprice30 own1930 sf1930 agg_occ1930 sh_foreignborn1930 sh_laborer1930 mean_ips_age1930 ///
    med_ips_valueh1930 med_ips_rent1930 med_ips_occscore1930, nonpar(black40) ///
    generate(npar_pred) partial (partial) nograph

/*** generate binned data on the "residuals" so that we can plot them ***/
/*** Here we are going to make bins that are 5 pct wide ***/

 gen pct_bin = round(black40*20)/20
 bysort pct_bin: egen residual = mean(partial) /* note: partial are the residuals */
 
 /* Identify one unique observation to use with each bin */
gen tag = 0
replace tag = 1 if pct_bin[_n] ~= pct_bin[_n-1]

/* Plot the figure: Note, the choice of gaussian kernal and polynomial of */
/* degree (1) exactly mimics what is done in the semi-par command.  Put another */
/* way, here we are producing the exact same picture that the semi-par command */
/* produces, only we can now format it and and the binned data as per our desire */
*graph drop _all

twoway (lpolyci partial black40, gaussian degree(1) ciplot(rline) lcolor(black)) (scatter residual pct_bin if tag == 1, mcolor(black)), ///
ytitle(Ln(Price 1940)) xtitle(Percent Black on Block in 1940) title(Ln(Price 1940) vs. ///
Pct. Black on the Block in 1940) subtitle(Robinson Double Residual w/ Full Controls) ///
legend(order( 3 "Binned Residuals" 1 "90% CI" ///
2 "f(% black on block in 1940)")) ///
bgcolor(white) graphregion(color(white)) plotregion(color(white))

graph rename Sale_combined


* Panel B

/*** Now Generate the graph separately for black and white ***/
twoway (lpolyci partial black40 if blackobs == 1, gaussian degree(1) ///
level(90) ciplot(rline) lcolor(black)) (lpolyci partial black40 if blackobs==0, ///
gaussian degree(1) level(90) ciplot(rline) lpattern(dash) lcolor(black)), ///
ytitle(Ln(Price 1940)) xtitle(Pct. Black on the Block in 1940) ///
title(Ln(Price 1940) vs.  Pct Black on Block in 1940) ///
subtitle(Robinson Double Residual w/ Full Controls) ///
legend(order( 2 "f{subscript:black}(% black on block in 1940)" 1 "90% CI" ///
3 "f{subscript:white}(% black on block in 1940)")) ///
bgcolor(white) graphregion(color(white)) plotregion(color(white))

graph rename Sale_black_v_white
********************************************************************************
********************************************************************************



********************************************************************************
**************** Table 1 *******************************************************
********************************************************************************
use blockbusting_master.dta, clear

* need ED-level owner share

gen owner_share1930 = owner_count1930/(owner_count1930+renter_counter1930)
gen owner_share1940 = owner_count1940/(owner_count1940+renter_counter1940)

keep if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1

mat sumstat = J(23,4,.)

local k = 1

foreach year in 1930 1940 {

summ ips_valueh`year' if own`year'==1 & pct_black_hh_on_block1940==0
mat sumstat[1,`k'] = r(mean)
mat sumstat[2,`k'] = r(sd)
mat sumstat[21,`k'] = r(N)

summ agg_rent`year' if own`year'==0 & pct_black_hh_on_block1940==0
mat sumstat[3,`k'] = r(mean)
mat sumstat[4,`k'] = r(sd)
mat sumstat[22,`k'] = r(N)

summ agg_occ`year' if pct_black_hh_on_block1940==0
mat sumstat[5,`k'] = r(mean)
mat sumstat[6,`k'] = r(sd)

summ head_count`year' if pct_black_hh_on_block1940==0
mat sumstat[7,`k'] = r(mean)
mat sumstat[8,`k'] = r(sd)

summ pct_black_hh_on_block`year' if pct_black_hh_on_block1940==0
mat sumstat[9,`k'] = r(mean)
mat sumstat[10,`k'] = r(sd)

summ sh_laborer`year' if pct_black_hh_on_block1940==0
mat sumstat[11,`k'] = r(mean)
mat sumstat[12,`k'] = r(sd)

summ sh_foreignborn`year' if pct_black_hh_on_block1940==0
mat sumstat[13,`k'] = r(mean)
mat sumstat[14,`k'] = r(sd)

summ mean_ips_age`year' if pct_black_hh_on_block1940==0
mat sumstat[15,`k'] = r(mean)
mat sumstat[16,`k'] = r(sd)

summ owner_share`year' if pct_black_hh_on_block1940==0
mat sumstat[17,`k'] = r(mean)
mat sumstat[18,`k'] = r(sd)

summ nd2g_addr_mile if pct_black_hh_on_block1940==0
mat sumstat[19,`k'] = r(mean)
mat sumstat[20,`k'] = r(sd)



local k = `k'+2

summ ips_valueh`year' if own`year'==1 & pct_black_hh_on_block1940>0
mat sumstat[1,`k'] = r(mean)
mat sumstat[2,`k'] = r(sd)
mat sumstat[21,`k'] = r(N)

summ agg_rent`year' if own`year'==0 & pct_black_hh_on_block1940>0
mat sumstat[3,`k'] = r(mean)
mat sumstat[4,`k'] = r(sd)
mat sumstat[22,`k'] = r(N)

summ agg_occ`year' if pct_black_hh_on_block1940>0
mat sumstat[5,`k'] = r(mean)
mat sumstat[6,`k'] = r(sd)

summ head_count`year' if pct_black_hh_on_block1940>0
mat sumstat[7,`k'] = r(mean)
mat sumstat[8,`k'] = r(sd)

summ pct_black_hh_on_block`year' if pct_black_hh_on_block1940>0
mat sumstat[9,`k'] = r(mean)
mat sumstat[10,`k'] = r(sd)

summ sh_laborer`year' if pct_black_hh_on_block1940>0
mat sumstat[11,`k'] = r(mean)
mat sumstat[12,`k'] = r(sd)

summ sh_foreignborn`year' if pct_black_hh_on_block1940>0
mat sumstat[13,`k'] = r(mean)
mat sumstat[14,`k'] = r(sd)

summ mean_ips_age`year' if pct_black_hh_on_block1940>0
mat sumstat[15,`k'] = r(mean)
mat sumstat[16,`k'] = r(sd)

summ owner_share`year' if pct_black_hh_on_block1940>0
mat sumstat[17,`k'] = r(mean)
mat sumstat[18,`k'] = r(sd)

summ nd2g_addr_mile if pct_black_hh_on_block1940>0
mat sumstat[19,`k'] = r(mean)
mat sumstat[20,`k'] = r(sd)

local k = `k'-1

}

drop _all
svmat sumstat
outsheet using table1.xls, replace
********************************************************************************
********************************************************************************



********************************************************************************
**************** Table 2 *******************************************************
********************************************************************************
use blockbusting_master.dta, clear


/**** Impact on Price ***/
reg lnprice40 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using price_effect, replace word excel dec(3) nocons ctitle("All Obs No Controls") 

reg lnprice40 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 sh_black1930 sh_foreignborn1930 sh_laborer1930 mean_ips_age1930 med_ips_valueh1930 med_ips_rent1930 med_ips_occscore1930 i.city_cd if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using price_effect, word excel dec(3) nocons ctitle("All Obs Controls") 

areg lnprice40 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using price_effect, word excel dec(3) nocons ctitle("All Obs ED Fixed Effects + %rent/#HH")

areg lnprice40 lnprice30 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)
outreg2 using price_effect, word excel dec(3) nocons ctitle("SFH ED Fixed Effects + %rent/#HH")

areg lnprice40 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if own1930 == 0 & pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using price_effect, word excel dec(3) nocons ctitle("Rental Only FE")
			
/*** Impact on Occupancy ***/
reg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using occ_effect, replace word excel dec(3) nocons ctitle("All Obs No Controls") 

reg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 sh_black1930 sh_foreignborn1930 sh_laborer1930 mean_ips_age1930 med_ips_valueh1930 med_ips_rent1930 med_ips_occscore1930 i.city_cd if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using occ_effect, word excel dec(3) nocons ctitle("All Obs Controls") 

areg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using occ_effect, word excel dec(3) nocons ctitle("All Obs ED Fixed Effects + %rent/#HH")

areg ln_occ_1940 lnprice30 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)
outreg2 using occ_effect, word excel dec(3) nocons ctitle("SFH ED Fixed Effects + %rent/#HH")

areg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if own1930 == 0 & pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using occ_effect, word excel dec(3) nocons ctitle("Rental Only FE")


********************************************************************************
********************************************************************************



********************************************************************************
**************** Table 3 *******************************************************
********************************************************************************
* Note: the coefficients from these 3 regressions are used to compute the entries
* in Table 3

use blockbusting_master.dta, clear

* All Addresses
areg lnprice40 lnprice30 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)
outreg2 using price_effect_bkdwn, replace word excel dec(3) nocons ctitle("ED FE All") 

* Occupancy Decreased							
areg lnprice40 lnprice30 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & agg_occ1930>=agg_occ1940, absorb(edid) cluster(blockid)							
outreg2 using price_effect_bkdwn, word excel dec(3) nocons ctitle("ED FE Occ Dec") 

* Occupancy Increased					
areg lnprice40 lnprice30 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & agg_occ1930<agg_occ1940, absorb(edid) cluster(blockid)							
outreg2 using price_effect_bkdwn, word excel dec(3) nocons ctitle("ED FE Occ Inc") 
********************************************************************************
********************************************************************************



********************************************************************************
**************** Table 4 *******************************************************
********************************************************************************
use blockbusting_master.dta, clear

/*** Impact on Price for all houses on blocks that remained white ***/

areg lnprice40 c.lnprice30##rent1930 rent1940 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & pct_black_hh_on_block1940 == 0, absorb(edid) cluster(blockid)
outreg2 using price_effect_w, replace word excel dec(3) nocons ctitle("All Obs FE")

areg lnprice40 lnprice30 rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 == 0, absorb(edid) cluster(blockid)
outreg2 using price_effect_w, word excel dec(3) nocons ctitle("ED Fixed Effects")	

/*** Impact on Price for all addresses on blocks that remained white that gained at least two members***/

areg lnprice40 c.lnprice30##rent1930 rent1940 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & pct_black_hh_on_block1940 == 0 & occ_change>2, absorb(edid) cluster(blockid)
outreg2 using price_effect_w, word excel dec(3) nocons ctitle("All Obs FE")

areg lnprice40 lnprice30 rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 == 0 & occ_change>2, absorb(edid) cluster(blockid)
outreg2 using price_effect_w, word excel dec(3) nocons ctitle("ED Fixed Effects")			

/*** Impact on Price for all addresses on blocks that remained white that gained at least three members***/

areg lnprice40 c.lnprice30##rent1930 rent1940 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & pct_black_hh_on_block1940 == 0 & occ_change>3, absorb(edid) cluster(blockid)
outreg2 using price_effect_w, word excel dec(3) nocons ctitle("All Obs FE")

areg lnprice40 lnprice30 rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 == 0 & occ_change>3, absorb(edid) cluster(blockid)
outreg2 using price_effect_w, word excel dec(3) nocons ctitle("ED Fixed Effects")
		
/*** Impact on Price for all addresses on blocks that remained white that gained at least four members***/

areg lnprice40 c.lnprice30##rent1930 rent1940 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & pct_black_hh_on_block1940 == 0 & occ_change>4, absorb(edid) cluster(blockid)
outreg2 using price_effect_w, word excel dec(3) nocons ctitle("All Obs FE")

areg lnprice40 lnprice30 rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 == 0 & occ_change>4, absorb(edid) cluster(blockid)
outreg2 using price_effect_w, word excel dec(3) nocons ctitle("ED Fixed Effects")
				
********************************************************************************
********************************************************************************

********************************************************************************
**************** Table 5 *******************************************************
********************************************************************************
use blockbusting_master.dta, clear

areg lnprice40 lnprice30 blk1940##rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 < .05, absorb(edid) cluster(blockid)
outreg2 using discrimination, replace word excel dec(3) nocons ctitle("Int ED FE <.05")

areg lnprice40 lnprice30 blk1940##rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 < .1, absorb(edid) cluster(blockid)
outreg2 using discrimination, word excel dec(3) nocons ctitle("Int ED FE <.10")

areg lnprice40 lnprice30 blk1940##rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 >= .4, absorb(edid) cluster(blockid)
outreg2 using discrimination, word excel dec(3) nocons ctitle("Int ED FE >=.4")

areg lnprice40 lnprice30 blk1940##rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 >= .6, absorb(edid) cluster(blockid)
outreg2 using discrimination, word excel dec(3) nocons ctitle("Int ED FE >=.6")
********************************************************************************
********************************************************************************


********************************************************************************
**************** Table 6 *******************************************************
********************************************************************************
use blockbusting_master.dta, clear

duplicates drop blockid, force

gen black50 = pct_black_hh_on_block1940 > .5

gen close_ghetto = nd2g_addr_mile < .1

foreach var in block_age block_laborersh block_fbshare block_avg_rentpp block_owner_share nd2g_addr_mile {

sum `var'
local temp = r(sd)
replace `var' = `var'/`temp'

}

reg pct_black_hh_on_block1940 block_age block_laborersh block_fbshare block_avg_rentpp block_owner_share if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using Prediction, replace word excel dec(3)

reg pct_black_hh_on_block1940 block_age block_laborersh block_fbshare block_avg_rentpp block_owner_share if pct_black_hh_on_block1930 <.05 & no_geocode==0, cluster(blockid)
outreg2 using Prediction, word excel dec(3) 

reg pct_black_hh_on_block1940 block_age block_laborersh block_fbshare block_avg_rentpp block_owner_share close_ghetto if pct_black_hh_on_block1930 <.05 & no_geocode==0, cluster(blockid)
outreg2 using Prediction, word excel dec(3) 

areg pct_black_hh_on_block1940 block_age block_laborersh block_fbshare block_avg_rentpp block_owner_share if pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using Prediction, word excel dec(3)

areg pct_black_hh_on_block1940 block_age block_laborersh block_fbshare block_avg_rentpp block_owner_share if pct_black_hh_on_block1930 <.05 & no_geocode==0, absorb(edid) cluster(blockid)
outreg2 using Prediction, word excel dec(3) 

areg pct_black_hh_on_block1940 block_age block_laborersh block_fbshare block_avg_rentpp block_owner_share close_ghetto if pct_black_hh_on_block1930 <.05 & no_geocode==0, absorb(edid) cluster(blockid)
outreg2 using Prediction, word excel dec(3) 


********************************************************************************
********************************************************************************





********************************************************************************
**************** Appendix Table VII *******************************************************
********************************************************************************
use blockbusting_master.dta, clear

gen close_ghetto = nd2g_addr_mile < .1

/*** Prices ***/						
areg lnprice40 lnprice30 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)							
outreg2 using price_effect_dist, replace word excel dec(3) nocons ctitle("ED Fixed Effects")

areg lnprice40 lnprice30 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & no_geocode==0, absorb(edid) cluster(blockid)
outreg2 using price_effect_dist, word excel dec(3) nocons ctitle("ED Geocoded") 

areg lnprice40 lnprice30 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 close_ghetto if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & no_geocode==0, absorb(edid) cluster(blockid)
outreg2 using price_effect_dist, word excel dec(3) nocons ctitle("ED Geocoded") 
 

/*** Pop ***/
areg ln_occ_1940 ln_occ_1930 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)							
outreg2 using pop_effect_dist, replace word excel dec(3) nocons ctitle("ED Fixed Effects") 

areg ln_occ_1940 ln_occ_1930 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & no_geocode==0, absorb(edid) cluster(blockid)
outreg2 using pop_effect_dist, word excel dec(3) nocons ctitle("ED Geocoded")
				
areg ln_occ_1940 ln_occ_1930 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 close_ghetto if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & no_geocode==0, absorb(edid) cluster(blockid)	
outreg2 using pop_effect_dist, word excel dec(3) nocons ctitle("ED Geocoded") 
********************************************************************************
********************************************************************************



********************************************************************************
******* Calculations/Estimates in Main Text, but not Tables/Figures*************
********************************************************************************
*
************ 1. Segregation Indices
*
* Note: Results are stored in the variables DisInd1930, DisInd1940, IsoInd1930 & IsoInd1940

use blockbusting_master.dta, clear

gen count = 1
collapse (sum) count blk1930 blk1940 (mean) pct_black_hh_on_block1930 pct_black_hh_on_block1940, by(blockid)

gen wht1930 = count - blk1930
gen wht1940 = count - blk1940

egen Totblk1930 = total(blk1930)
egen Totblk1940 = total(blk1940)

egen Totwht1930 = total(wht1930)
egen Totwht1940 = total(wht1940)

gen dcont30 = .5*abs(wht1930/Totwht1930 - blk1930/Totblk1930)
gen dcont40 = .5*abs(wht1940/Totwht1940 - blk1940/Totblk1940)

egen DisInd1930 = total(dcont30)
egen DisInd1940 = total(dcont40)

gen icont30 = blk1930/Totblk1930*pct_black_hh_on_block1930
gen icont40 = blk1940/Totblk1940*pct_black_hh_on_block1940

egen IsoInd1930 = total(icont30)
egen IsoInd1940 = total(icont40)

*
************ 2. Compute Wages For Black Southerners/Northerners & Migrators
*

use "IPUMS_Full_Sample_1940_Black_Only.dta", clear


* Drop bad/missing/top-coded wages

drop if incwage == 999998

* Identify States from the Confederacy

gen south = 0

replace south = 1 if stateicp >= 40 & stateicp <= 49
replace south = 1 if stateicp == 54

* Identify individual who lived in the south 5 years ago

gen south5yrsago = 0

replace south5yrsago = 1 if migplac5 == 1
replace south5yrsago = 1 if migplac5 == 5
replace south5yrsago = 1 if migplac5 == 12
replace south5yrsago = 1 if migplac5 == 13
replace south5yrsago = 1 if migplac5 == 22
replace south5yrsago = 1 if migplac5 == 28
replace south5yrsago = 1 if migplac5 == 37
replace south5yrsago = 1 if migplac5 == 45
replace south5yrsago = 1 if migplac5 == 47
replace south5yrsago = 1 if migplac5 == 48
replace south5yrsago = 1 if migplac5 == 51

* Identify Observations in our Sample Cities

gen SampleCity = 0

replace SampleCity =1 if city == 530
replace SampleCity =1 if city == 810
replace SampleCity =1 if city == 1190
replace SampleCity =1 if city == 1290
replace SampleCity =1 if city == 1330
replace SampleCity =1 if city == 1750
replace SampleCity =1 if city == 4610
replace SampleCity =1 if city == 5330
replace SampleCity =1 if city == 5370
replace SampleCity =1 if city == 6090

* Note: Limit Sample to Men
* Average black income in the former confederacy in 1940

 sum incwage if classwkr == 2 & wkswork2 == 6 & race == 2 & sex ==1 & south == 1 & age >= 18 & age <= 60

* Average Black Wage in our Sample Cities in 1940

 sum incwage if classwkr == 2 & wkswork2 == 6 & race == 2 & sex ==1 & SampleCity == 1 & age >= 18 & age <= 60
 
* Average Black Wage in our Sample Cities  in 1940 For those who moved from the south in the last 5 Years

 sum incwage if classwkr == 2 & wkswork2 == 6 & race == 2 & sex ==1 & SampleCity == 1 & south5yrsago ==1 & age >= 18 & age <= 60

 *
 ************ 3. Computing Mean Black rent in 1940 & mean Black home value in 1940 on blocks that were less than 10% black
 *
 
 use blockbusting_master.dta, clear
 
 * Rent
 sum agg_rent1940 if blk1940 ==1 & own1940 == 0
 
 * House Price
 sum ips_valueh1940 if blk1940 ==1 & own1940 == 1 & pct_black_hh_on_block1940 <=.1
 
*********** 4.  Unconditional Mean Rent and Home Value by race of address head

** 1940
* Black Rent
 sum agg_rent1940 if blk1940 ==1 & own1940 == 0
 
 * Black House Price
 sum ips_valueh1940 if blk1940 ==1 & own1940 == 1
 
 * White Rent
 sum agg_rent1940 if blk1940 ==0 & own1940 == 0
 
 * White House Price
 sum ips_valueh1940 if blk1940 ==0 & own1940 == 1
 
 **1930
 * Black Rent
 sum agg_rent1930 if blk1930 ==1 & own1930 == 0
 
 * Black House Price
 sum ips_valueh1930 if blk1930 ==1 & own1930 == 1
 
 * White Rent
 sum agg_rent1930 if blk1930 ==0 & own1930 == 0
 
 * White House Price
 sum ips_valueh1930 if blk1930 ==0 & own1930 == 1
 
 
 
 
 
 *
 ************ 5. Compute income differences for pioneering black families
 *
 
 use blockbusting_master.dta, clear
 

 
 areg agg_inc1940 blk1940 if pct_black_hh_on_block1940 <=.1 & own1940==1, absorb(blockid)
 
 
 * compute the average white owner-occupied agg income
 sum agg_inc1940 if pct_black_hh_on_block1940 <=.1 & own1940 ==1 & blk1940==0

********************************************************************************
********************************************************************************
 
 
********************************************************************************
******* Appendix Figure I ******************************************************
********************************************************************************
use "Pittsburgh_sales_matched.dta", replace 

/* Step one, Identify Observations With Multiple addressses and Drop */
* only use close years 
drop if (salesyear > 1931 & salesyear < 1940) | salesyear > 1941

drop if year == 1940 & salesyear < 1939
drop if year == 1930 & salesyear > 1931

save temp1, replace

drop count
gen count = 1
collapse (sum) count, by(transaction_ID)
keep if count == 1
sort transaction_ID

save temp2, replace

use temp1, replace 

drop _merge
sort transaction_ID
merge transaction_ID using temp2

keep if _merge == 3


* note: too few 1929 observations: so we drop them *
drop if salesyear == 1929

* price adjustments for Price Index Estimated via: xi:reg lnprice i.salesyear ward
* and then taking exponent of the year indicator.

gen adjprice = SaleAmount
replace adjprice = SaleAmount* .94903975 if salesyear == 1931
replace adjprice = SaleAmount* .78924759 if salesyear == 1941

 gen dif = .
 replace dif = ips_valueh - adjprice if homeownrent == "Owned" & ips_valueh < 999999
 
 gen pct_dif = dif/adjprice



kdensity dif if salesyear == 1930 | salesyear == 1940  & SaleA > 500 & SaleA < 10000, ///
ytitle(Density)  xtitle(Census Value - Recorder of Deeds Value) title(Census Value vs. Deed Value)


********************************************************************************
********************************************************************************
 
 
 
 
********************************************************************************
**************** Appendix Figure II *********************************************
********************************************************************************
* Panel A

use blockbusting_master.dta, clear



gen blackobs = (b_b ==1 | w_b ==1) /** I need this variable and it wasn't created **/


/**** Do them separately by race.  Starting with Black Households ***/

keep if pct_black_hh_on_block1930 ==0 & sf1930 == 1 & own1930 == 1  & black40 > 0 & blackobs == 1


/*** generate binned data on the ownership Percentage so that we can plot them ***/
/*** Here we are going to make bins that are 5 pct wide ***/

 gen pct_bin = round(black40*20)/20
 bysort pct_bin: egen pct_own = mean(own1940) /* note: partial are the residuals */
 
 /* Identify one unique observation to use with each bin */
gen tag = 0
replace tag = 1 if pct_bin[_n] ~= pct_bin[_n-1]

/* Plot the figure: Note, the choice of gaussian kernal and polynomial of */
/* degree (1) exactly mimics what is done in the semi-par command.  Put another */
/* way, here we are producing the exact same picture that the semi-par command */
/* produces, only we can now format it and and the binned data as per our desire */


twoway (lpolyci own1940 black40, gaussian degree(1) ciplot(rline)) (scatter pct_own pct_bin if tag ==1), ///
ytitle(Black Ownership Rate) xtitle(Percent Black on Block in 1940) title(Ownership Rate vs. ///
Pct. Black on the Block in 1940) legend(order( 3 "Binned Means" 2 "Mean Ownership Rate" 1 "95% CI"))

graph rename Ownership_Rate_black

* Panel B

use blockbusting_master.dta, clear
gen blackobs = (b_b ==1 | w_b ==1) /** I need this variable and it wasn't created **/

/* only keep sample used in regressions */

keep if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1  & black40 > 0 & blackobs == 0


/*** generate binned data on the ownership Percentage so that we can plot them ***/
/*** Here we are going to make bins that are 5 pct wide ***/

 gen pct_bin = round(black40*20)/20
 bysort pct_bin: egen pct_own = mean(own1940) /* note: partial are the residuals */
 
 /* Identify one unique observation to use with each bin */
gen tag = 0
replace tag = 1 if pct_bin[_n] ~= pct_bin[_n-1]

/* Plot the figure: Note, the choice of gaussian kernal and polynomial of */
/* degree (1) exactly mimics what is done in the semi-par command.  Put another */
/* way, here we are producing the exact same picture that the semi-par command */
/* produces, only we can now format it and and the binned data as per our desire */


twoway (lpolyci own1940 black40, gaussian degree(1) ciplot(rline)) (scatter pct_own pct_bin if tag ==1), ///
ytitle(White Ownership Rate) xtitle(Percent Black on Block in 1940) title(Ownership Rate vs. ///
Pct. Black on the Block in 1940) legend(order( 3 "Binned Means" 2 "Mean Ownership Rate" 1 "95% CI"))

graph rename Ownership_Rate_White
********************************************************************************
********************************************************************************

* Note: Appendix Figures III & IV are Maps 
 
 ********************************************************************************
******* Appendix Figure V ******************************************************
********************************************************************************

use blockbusting_master.dta, clear

* Setup output data set named "out"
postfile out threshold rent rent_lo rent_hi transition transition_lo transition_hi rentXtran rentXtran_lo rentXtran_hi using "results.dta", replace

* Create a variable to measure above the threshold

capture drop bl_gt_threshold
gen bl_gt_threshold = 0


* Loop over different windows *

forvalues threshold = 0.01 (.01) .9 {
	display `threshold'
	replace bl_gt_threshold = 0
	replace bl_gt_threshold = 1 if pct_black_hh_on_block1940 > `threshold'
	
	display "a"
	
	areg lnprice40 lnprice30 rent1940##bl_gt_threshold agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 <.05 & sf1930 == 1 & own1930 == 1, absorb(edid)


	mat results = r(table)
	local rent = results[1,3]
	local rent_lo = results[5,3]
	local rent_hi = results[6,3]


	local transition = results[1,5]
	local transition_lo = results[5,5]
	local transition_hi = results[6,5]

	local rentXtran = results[1,9]
	local rentXtran_lo = results[5,9]
	local rentXtran_hi = results[6,9]



	display `rent'
	display `rent_lo'
	display `rent_hi'

	display `transition'
	display `transition_lo'
	display `transition_hi'

	display `rentXtran'
	display `rentXtran_lo'
	display `rentXtran_hi'


* post results to results file "out"
	post out (`threshold') (`rent') (`rent_lo') (`rent_hi') (`transition') (`transition_lo') (`transition_hi') (`rentXtran') (`rentXtran_lo') (`rentXtran_hi')



}

*close the output file

postclose out

*list the results 
preserve
use results.dta, clear
list


*draw graphs
*rent
*twoway (line rent threshold, lcolor(black)) (line rent_lo threshold, lcolor(black) lpattern(dash)) (line rent_hi threshold, lcolor(black) lpattern(dash)), ytitle(Value) xtitle(Transition Threshold ) title(Rental Coefficient Sensitivity to Transition Threshold, size(medium))  legend(order(1 "Estimated Value" 2 "95% Confidence Interval")) name(Sens_Thresh_Rent_Col3, replace)

* Panel A
twoway (line transition threshold, lcolor(black)) (line transition_lo threshold, lcolor(black) lpattern(dash)) (line transition_hi threshold, lcolor(black) lpattern(dash)), ytitle(Value)  xtitle(Transition Threshold) title(Transition Coefficient Sensitivity to Transition Threshold, size(medium))  legend(order(1 "Estimated Value" 2 "95% Confidence Interval")) name(Sens_Thresh_Transition_Col3, replace)

* Panel B
twoway (line rentXtran threshold, lcolor(black)) (line rentXtran_lo threshold, lcolor(black) lpattern(dash)) (line rentXtran_hi threshold, lcolor(black) lpattern(dash)), ytitle(Value)  xtitle(Transition Threshold) title(RenXTrans Coefficient Sensitivity to Transition Threshold, size(medium))  legend(order(1 "Estimated Value" 2 "95% Confidence Interval")) name(Sens_Thresh_RentXTrans_Col3, replace)

restore
********************************************************************************
********************************************************************************

********************************************************************************
******* Appendix Figure VI ******************************************************
********************************************************************************

use blockbusting_master.dta, clear

* Setup output data set named "out"
postfile out lb ub rent rent_lo rent_hi transition transition_lo transition_hi rentXtran rentXtran_lo rentXtran_hi using "results.dta", replace

* Loop over different windows *

forvalues ub = 0 (.01) .5 {
	display `ub'
	display `ub'-.05


	reg lnprice40 lnprice30 rent1940##black40_gt_50 if pct_black_hh_on_block1930 >= (0) & pct_black_hh_on_block1930 <=`ub' & sf1930 == 1 & own1930 == 1


	mat results = r(table)
	local rent = results[1,3]
	local rent_lo = results[5,3]
	local rent_hi = results[6,3]


	local transition = results[1,5]
	local transition_lo = results[5,5]
	local transition_hi = results[6,5]

	local rentXtran = results[1,9]
	local rentXtran_lo = results[5,9]
	local rentXtran_hi = results[6,9]



	display `rent'
	display `rent_lo'
	display `rent_hi'

	display `transition'
	display `transition_lo'
	display `transition_hi'

	display `rentXtran'
	display `rentXtran_lo'
	display `rentXtran_hi'

* post results to results file "out"
	post out (0) (`ub') (`rent') (`rent_lo') (`rent_hi') (`transition') (`transition_lo') (`transition_hi') (`rentXtran') (`rentXtran_lo') (`rentXtran_hi')



}

*close the output file

postclose out

*list the results 
preserve
use results.dta, clear
list

*draw graphs
*rent
*twoway (line rent ub, lcolor(black)) (line rent_lo ub, lcolor(black) lpattern(dash)) (line rent_hi ub, lcolor(black) lpattern(dash)), ytitle(Value) xtitle(Upper Percent Black Limit in Baseline  Community) title(Rental Coefficient Sensitivity to Baseline Percent Black, size(medium))  legend(order(1 "Estimated Value" 2 "95% Confidence Interval")) name(Sens_Price_Rental_Col1, replace)

* Panel A
twoway (line transition ub, lcolor(black)) (line transition_lo ub, lcolor(black) lpattern(dash)) (line transition_hi ub, lcolor(black) lpattern(dash)), ytitle(Value)  xtitle(Upper Percent Black Limit in Baseline  Community) title(Racial Transition Coefficient Sensitivity to Baseline Percent Black, size(medium))  legend(order(1 "Estimated Value" 2 "95% Confidence Interval")) name(Sens_Transition_Rental_Col1, replace)

* Panel B
twoway (line rentXtran ub, lcolor(black)) (line rentXtran_lo ub, lcolor(black) lpattern(dash)) (line rentXtran_hi ub, lcolor(black) lpattern(dash)), ytitle(Value)  xtitle(Upper Percent Black Limit in Baseline Community) title(RenXTrans Coefficient Sensitivity to Baseline Pct. Black, size(medium))  legend(order(1 "Estimated Value" 2 "95% Confidence Interval")) name(Sens_RentXTrans_Rental_Col1, replace)

restore
********************************************************************************
********************************************************************************
 


********************************************************************************
**************** Appendix Figure VII **************************************
********************************************************************************
* Replicate Figure 2 droping all white observations with tenure > 5 years

use blockbusting_master.dta, clear

* Panel A

gen blackobs = (b_b ==1 | w_b ==1) /** I need this variable and it wasn't created **/


keep if pct_black_hh_on_block1930 ==0 & sf1930 == 1 & own1930 == 1 & rent1940==1 & black40 > 0

* drop all long-term white renters
drop if old_white_hhs1940 > 0 

semipar lnprice40  lnprice30 own1930 sf1930 agg_occ1930 sh_foreignborn1930 sh_laborer1930 mean_ips_age1930 ///
    med_ips_valueh1930 med_ips_rent1930 med_ips_occscore1930, nonpar(black40) ///
    generate(npar_pred) partial (partial) nograph

/*** generate binned data on the "residuals" so that we can plot them ***/
/*** Here we are going to make bins that are 5 pct wide ***/

 gen pct_bin = round(black40*20)/20
 bysort pct_bin: egen residual = mean(partial) /* note: partial are the residuals */
 
 /* Identify one unique observation to use with each bin */
gen tag = 0
replace tag = 1 if pct_bin[_n] ~= pct_bin[_n-1]

/* Plot the figure: Note, the choice of gaussian kernal and polynomial of */
/* degree (1) exactly mimics what is done in the semi-par command.  Put another */
/* way, here we are producing the exact same picture that the semi-par command */
/* produces, only we can now format it and and the binned data as per our desire */
graph drop _all

twoway (lpolyci partial black40, gaussian degree(1) ciplot(rline)) (scatter residual pct_bin if tag == 1), ///
ytitle(Ln(Rent 1940)) xtitle(Percent Black on Block in 1940) title(Ln(Rent 1940) vs. ///
Pct. Black on the Block in 1940) subtitle(Robinson Double Residual w/ Full Controls) ///
legend(order( 3 "Binned Residuals" 1 "90% CI" ///
2 "f(% black on block in 1940)"))

graph rename Rent_combined_No_Old_Whites

* Panel B

/*** Now Generate the graph separately for black and white ***/
twoway (lpolyci partial black40 if blackobs == 1, gaussian degree(1) ///
level(90) ciplot(rline)) (lpolyci partial black40 if blackobs==0, ///
gaussian degree(1) level(90) ciplot(rline)), ///
ytitle(Ln(Rent 1940)) xtitle(Pct. Black on the Block in 1940) ///
title(Ln. (Rent 1940) vs.  Pct Black on Block in 1940) ///
subtitle(Robinson Double Residual w/ Full Controls) ///
legend(order( 2 "f{subscript:black}(% black on block in 1940)" 1 "90% CI" ///
3 "f{subscript:white}(% black on block in 1940)"))

graph rename Rent_black_v_white_No_Old_Whites
********************************************************************************
********************************************************************************

********************************************************************************
**************** Appendix Figure VIII **************************************
********************************************************************************
*Figure 3 with out old whites

use blockbusting_master.dta, clear

* Panel A

gen blackobs = (b_b ==1 | w_b ==1) /** I need this variable and it wasn't created **/

/*** Drop unused observations ***/

* drop all long-term white renters
drop if old_white_hhs1940 > 0 

/*** note: 3 different levels of refinement ***/

keep if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & rent1940==0 & black40 > 0
*keep if pct_black_hh_on_block1930 <=.01 & sf1930 == 1 & rent1940==0 & black40 > 0
*keep if pct_black_hh_on_block1930 <=.01 & rent1940==0 & black40 > 0


semipar lnprice40  lnprice30 own1930 sf1930 agg_occ1930 sh_foreignborn1930 sh_laborer1930 mean_ips_age1930 ///
    med_ips_valueh1930 med_ips_rent1930 med_ips_occscore1930, nonpar(black40) ///
    generate(npar_pred) partial (partial) nograph

/*** generate binned data on the "residuals" so that we can plot them ***/
/*** Here we are going to make bins that are 5 pct wide ***/

 gen pct_bin = round(black40*20)/20
 bysort pct_bin: egen residual = mean(partial) /* note: partial are the residuals */
 
 /* Identify one unique observation to use with each bin */
gen tag = 0
replace tag = 1 if pct_bin[_n] ~= pct_bin[_n-1]

/* Plot the figure: Note, the choice of gaussian kernal and polynomial of */
/* degree (1) exactly mimics what is done in the semi-par command.  Put another */
/* way, here we are producing the exact same picture that the semi-par command */
/* produces, only we can now format it and and the binned data as per our desire */
*graph drop _all

twoway (lpolyci partial black40, gaussian degree(1) ciplot(rline)) (scatter residual pct_bin if tag == 1), ///
ytitle(Ln(Price 1940)) xtitle(Percent Black on Block in 1940) title(Ln(Price 1940) vs. ///
Pct. Black on the Block in 1940) subtitle(Robinson Double Residual w/ Full Controls) ///
legend(order( 3 "Binned Residuals" 1 "90% CI" ///
2 "f(% black on block in 1940)"))

graph rename Sale_combined_no_old_whites


* Panel B

/*** Now Generate the graph separately for black and white ***/
twoway (lpolyci partial black40 if blackobs == 1, gaussian degree(1) ///
level(90) ciplot(rline)) (lpolyci partial black40 if blackobs==0, ///
gaussian degree(1) level(90) ciplot(rline)), ///
ytitle(Ln(Price 1940)) xtitle(Pct. Black on the Block in 1940) ///
title(Ln(Price 1940) vs.  Pct Black on Block in 1940) ///
subtitle(Robinson Double Residual w/ Full Controls) ///
legend(order( 2 "f{subscript:black}(% black on block in 1940)" 1 "90% CI" ///
3 "f{subscript:white}(% black on block in 1940)"))

graph rename Sale_black_v_white_no_old_whites
********************************************************************************
********************************************************************************

* Note: Appendix Tables 1 - 3 are descriptions of the matching process 

********************************************************************************
**************** Appendix Table IV **********************************************
********************************************************************************
use blockbusting_master.dta, clear

/*** Prices ***/	

areg lnprice40 c.lnprice30##rent1930 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using effect_bkdwn, replace word excel dec(3) nocons ctitle("All Obs ED Fixed Effects + %rent/#HH")

areg lnprice40 lnprice30 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)
outreg2 using effect_bkdwn, word excel dec(3) nocons ctitle("SFH ED Fixed Effects + %rent/#HH")

areg lnprice40 c.lnprice30##rent1930 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if own1930 == 0 & pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using effect_bkdwn, word excel dec(3) nocons ctitle("Rental Only FE")
			
/*** Pop ***/

areg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using effect_bkdwn, word excel dec(3) nocons ctitle("All Obs ED Fixed Effects + %rent/#HH")

areg ln_occ_1940 lnprice30 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)
outreg2 using effect_bkdwn, word excel dec(3) nocons ctitle("SFH ED Fixed Effects + %rent/#HH")

areg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_1_10 rent1940##black40_10_50 rent1940##black40_50_100 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if own1930 == 0 & pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using effect_bkdwn, word excel dec(3) nocons ctitle("Rental Only FE")
		
********************************************************************************
********************************************************************************

********************************************************************************
**************** Appendix Table V ***************************************
********************************************************************************
* Replicate Table 2 dropping all white observations with tenure > 5 years

use blockbusting_master.dta, clear

*drop long-term white renters
drop if rent1940==1 & old_white_hhs1940 > 0

/**** Impact on Price ***/

reg lnprice40 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using price_effect_all_new, replace word excel dec(3) nocons ctitle("All Obs No Controls") 

reg lnprice40 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 sh_black1930 sh_foreignborn1930 sh_laborer1930 mean_ips_age1930 med_ips_valueh1930 med_ips_rent1930 med_ips_occscore1930 i.city_cd if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using price_effect_all_new, word excel dec(3) nocons ctitle("All Obs Controls") 

areg lnprice40 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using price_effect_all_new, word excel dec(3) nocons ctitle("All Obs ED Fixed Effects + %rent/#HH")

areg lnprice40 lnprice30 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)
outreg2 using price_effect_all_new, word excel dec(3) nocons ctitle("SFH ED Fixed Effects + %rent/#HH")

areg lnprice40 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if own1930 == 0 & pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using price_effect_all_new, word excel dec(3) nocons ctitle("Rental Only FE")
			
/*** Impact on Occupancy ***/
reg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using occ_effect_all_new, replace word excel dec(3) nocons ctitle("All Obs No Controls") 

reg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 sh_black1930 sh_foreignborn1930 sh_laborer1930 mean_ips_age1930 med_ips_valueh1930 med_ips_rent1930 med_ips_occscore1930 i.city_cd if pct_black_hh_on_block1930 == 0, cluster(blockid)
outreg2 using occ_effect_all_new, word excel dec(3) nocons ctitle("All Obs Controls") 

areg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using occ_effect_all_new, word excel dec(3) nocons ctitle("All Obs ED Fixed Effects + %rent/#HH")

areg ln_occ_1940 lnprice30 rent1940##black40_gt_50 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1, absorb(edid) cluster(blockid)
outreg2 using occ_effect_all_new, word excel dec(3) nocons ctitle("SFH ED Fixed Effects + %rent/#HH")

areg ln_occ_1940 c.lnprice30##rent1930 rent1940##black40_gt_50 c.agg_occ1930##rent1930 pct_renters_on_block1930 hh_on_block1930 if own1930 == 0 & pct_black_hh_on_block1930 == 0, absorb(edid) cluster(blockid)
outreg2 using occ_effect_all_new, word excel dec(3) nocons ctitle("Rental Only FE")

********************************************************************************
********************************************************************************


********************************************************************************
**************** Appendix Table VI ***************************************
********************************************************************************
* Replicate Table 5 droping all white observations with tenure > 5 years

use blockbusting_master.dta, clear
*drop long-term white renters
drop if rent1940==1 & old_white_hhs1940 > 0

areg lnprice40 lnprice30 blk1940##rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 < .05, absorb(edid) cluster(blockid)
outreg2 using discrimination_all_new, replace word excel dec(3) nocons ctitle("Int ED FE <.05")

areg lnprice40 lnprice30 blk1940##rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 < .1, absorb(edid) cluster(blockid)
outreg2 using discrimination_all_new, word excel dec(3) nocons ctitle("Int ED FE <.10")

areg lnprice40 lnprice30 blk1940##rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 >= .4, absorb(edid) cluster(blockid)
outreg2 using discrimination_all_new, word excel dec(3) nocons ctitle("Int ED FE >=.4")

areg lnprice40 lnprice30 blk1940##rent1940 agg_occ1930 pct_renters_on_block1930 hh_on_block1930 if pct_black_hh_on_block1930 == 0 & sf1930 == 1 & own1930 == 1 & pct_black_hh_on_block1940 >= .6, absorb(edid) cluster(blockid)
outreg2 using discrimination_all_new, word excel dec(3) nocons ctitle("Int ED FE >=.6")
********************************************************************************
********************************************************************************
